<template>
	<view class="container">
		<view v-if="job">
			<view class="job-title">{{ job.title }}</view>
			<view class="job-tags">
				<text class="tag" v-for="tag in job.tags" :key="tag">{{ tag }}</text>
			</view>
			<view class="job-info">
				<text>{{ job.location }}</text>
				<text>· 距离：{{ job.distance }}</text>
			</view>
			<view class="job-time">截止时间：{{ job.deadline }}</view>
			<view class="job-bottom">
				<text class="cert" v-if="job.cert">企业认证</text>
				<text class="real" v-if="job.real">已实名</text>
				<text class="views">共{{ job.views }}个浏览</text>
			</view>
		</view>
		<view v-else>未找到该职位信息</view>
	</view>
</template>

<script setup lang="ts">
import { onLoad } from '@dcloudio/uni-app'
import { ref } from 'vue';
const jobs = [
	{ id: 1, title: '天津河西区装卸队招装卸工，白班日结350-500，管吃管住', tags: ['操作工', '普工', '180/天'], location: '天津市农学院南行200米', distance: '5km', deadline: '2024-12-12 24:00', cert: true, real: true, views: 238 },
	{ id: 2, title: '销售经理1名，能吃苦耐劳，管吃管住', tags: ['销售', '普工', '200/天'], location: '天津市南开区', distance: '3km', deadline: '2024-12-15 18:00', cert: true, real: false, views: 120 },
	{ id: 3, title: '天津滨海新区招普工，包吃住', tags: ['普工', '包吃住', '150/天'], location: '滨海新区工业园', distance: '8km', deadline: '2024-12-20 20:00', cert: false, real: true, views: 98 },
	{ id: 4, title: '河东区招操作工，月结', tags: ['操作工', '月结', '5000/月'], location: '河东区', distance: '2km', deadline: '2024-12-30 12:00', cert: true, real: true, views: 56 },
	{ id: 5, title: '塘沽招装卸工，日结', tags: ['装卸工', '日结', '220/天'], location: '塘沽区', distance: '12km', deadline: '2024-12-25 17:00', cert: false, real: false, views: 77 },
	{ id: 6, title: '西青区招普工', tags: ['普工', '180/天'], location: '西青区', distance: '6km', deadline: '2024-12-18 19:00', cert: true, real: true, views: 201 },
	{ id: 7, title: '南开区招销售', tags: ['销售', '提成', '3000+'], location: '南开区', distance: '4km', deadline: '2024-12-22 10:00', cert: false, real: true, views: 65 },
	{ id: 8, title: '河西区招搬运工', tags: ['搬运工', '180/天'], location: '河西区', distance: '5km', deadline: '2024-12-28 16:00', cert: true, real: false, views: 89 },
	{ id: 9, title: '塘沽招普工', tags: ['普工', '包吃住', '160/天'], location: '塘沽区', distance: '13km', deadline: '2024-12-29 15:00', cert: false, real: true, views: 44 },
	{ id: 10, title: '东丽区招装卸工', tags: ['装卸工', '180/天'], location: '东丽区', distance: '7km', deadline: '2024-12-27 14:00', cert: true, real: false, views: 33 }
];
const job = ref(null);
onLoad((options) => {
	let id = null;
	// #ifdef H5
	id = Number(options.id);
	console.log(options,42);
	// #endif
	// #ifndef H5
		id = Number(options.id);
		console.log(options,49);
	
	// #endif
	console.log(id,51);
	
	job.value = jobs.find(j => j.id === id) || null;
});
</script>

<style scoped>
.container { padding: 24rpx; }
.job-title { font-weight: bold; font-size: 32rpx; margin-bottom: 12rpx; }
.job-tags { margin-bottom: 12rpx; }
.tag { background: #f0f0f0; color: #007aff; border-radius: 6rpx; padding: 2rpx 10rpx; margin-right: 8rpx; font-size: 22rpx; }
.job-info { color: #888; font-size: 24rpx; margin-bottom: 8rpx; }
.job-time { color: #faad14; font-size: 24rpx; margin-bottom: 8rpx; }
.job-bottom { display: flex; align-items: center; gap: 16rpx; }
.cert, .real, .views { color: #1890ff; font-size: 22rpx; }
</style>
